﻿using CaseManagerLibrary.Socket;
using System;

namespace PSDManager.Protocols
{
    public class ClientMessageProcessor
    {
        public MessageBase Message { get; set; }
        public static ClientMessageProcessor Parse(MessageBase message)
        {
            ClientMessageProcessor msgProcess = null;
            if (message != null)
            {
                string processer = "PSDManager.Protocols." + message.Name + "Processor";

                System.Reflection.Assembly assm = System.Reflection.Assembly.Load("PSDManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
                Type processerType = assm.GetType(processer);
                msgProcess = (ClientMessageProcessor)Activator.CreateInstance(processerType);
                msgProcess.Message = message;
            }

            return msgProcess;
        }

        public virtual void Run(ManagerHelper mgrHelper)
        {
        }
    }
}
